#include "Quadrilateral.h"
#include <QDebug>

Quadrilateral::Quadrilateral()
{
    m_texture = 0;
}

Quadrilateral::Quadrilateral(QPoint* p1, QPoint* p2, QPoint* p3,QPoint* p4)
{
    m_texture = 0;
    m_vertexs.clear();
    m_vertexs.append(p1);
    m_vertexs.append(p2);
    m_vertexs.append(p3);
    m_vertexs.append(p4);
}

void Quadrilateral::draw(QPainter* painter)
{

    if(filled())
    {
        FilledQuadrilateral* filledQuadrilateral = new FilledQuadrilateral(m_vertexs,m_colors);
        if(texture()) filledQuadrilateral->setTexture(texture());
        filledQuadrilateral->draw(painter);
    }
    if(wired())
    {
        WiredQuadrilateral* wiredQuadrilateral = new WiredQuadrilateral(m_vertexs,m_colors);
        wiredQuadrilateral->draw(painter);
    }
}
